public class DynamicComponentExample {

    public DynamicComponentExample(ApexPages.StandardController controller) {
        controller.addFields(editableFields);
    }
    
    public List<String> editableFields {
        get {
            if (editableFields == null) {
                editableFields = new List<String>();
                editableFields.add('FirstName');
                editableFields.add('LastName');
                editableFields.add('Phone');
                editableFields.add('Fax');
                editableFields.add('Email');
            }
            return editableFields ;
        }
        private set;
    }
    
    public Component.Apex.SectionHeader getHeaderWithDueDateCheck() {
        date dueDate = date.newInstance(2012, 7, 19);
        Component.Apex.SectionHeader sectionHeader = new Component.Apex.SectionHeader();
        sectionHeader.title = 'Our classes will be finished  by ' + dueDate.format() + '!';
        return sectionHeader;
    }
    
    public Component.Apex.OutputText getMyOutputText() {
       Component.Apex.OutputText outText = new Component.Apex.OutputText();
        outText.value = 'Some dynamic output text.';
        return outText;
    }
    
}